import os
from multiprocessing import Process

def run_server():
    """执行server的命令"""
    cmd = 'nohup docker exec s1102 bash -c "server --ip=192.168.11.2 --port=11102 --proto=17" > server_1102.out 2>&1 & echo $! > PID_SERVER_1'
    print(os.getpid())
    os.system(cmd)
    

def run_client():
    """执行client的命令"""
    cmd = 'nohup docker exec s1101 bash -c "client-dstip=192.168.11.2 --dstport=11102  -t 2 -b 25000 -n 0" > client_1101_1.out 2>&1 & echo $! > PID_CLIENT_1'
    print(os.getpid())
    os.system(cmd)


if __name__ == "__main__":
    p1 = Process(target=run_server, name="server_1")
    p2 = Process(target=run_client, name="client_1")

    p1.start()
    p2.start()
    